// pages/video-detail/video-detail.js
Page({
  data: {
    videoInfo: {
      id: 1,
      title: '微信小程序开发入门教程',
      videoUrl: 'https://example.com/video.mp4',
      description: '本课程将带你从零开始掌握小程序开发...',
      viewCount: 12345,
      createTime: '2024-03-20',
      duration: '15:30'
    },
    _UrlGet_: wx.getStorageSync('img_url'),
    danmuList: [
      { text: '讲得真好！', color: '#ff0000', time: 3 },
      { text: '学到了', color: '#00ff00', time: 10 }
    ]
  },

  onLoad(options) {
    console.log('videoinfo',JSON.parse(decodeURIComponent(options.videoItem)));
    this.setData({
      videoInfo: JSON.parse(decodeURIComponent(options.videoItem))
    })
  },

  getVideoDetail(id) {
    // 示例请求方法
    wx.request({
      url: `https://api.example.com/videos/${id}`,
      success: res => {
        this.setData({ videoInfo: res.data })
      }
    })
  },

  onReady() {
    this.videoContext = wx.createVideoContext('myVideo')
  }
})